package DongTai.RentCar.src.cars;

import java.util.Scanner;

public class Car {
    Scanner scanner = new Scanner(System.in);
    private String vehicleId; // 车牌号
    private String brand;   // 品牌
    private String type;    // 型号
    private int perRent; // 日租金

    // 构造方法
    public Car(String vehicleId, String brand, String type, int perRent) {
        this.vehicleId = vehicleId;
        this.brand = brand;
        this.type = type;
        this.perRent = perRent;
    }

    /**
     * 计算租金
     * @param days 租赁天数
     * @return 计算后的租金
     */
    public float calRent(int days) {
        float rent = perRent * days;
        if (days > 150) {
            rent *= 0.7;  // 70% 折扣
        } else if (days > 30) {
            rent *= 0.8;  // 80% 折扣
        } else if (days > 7) {
            rent *= 0.9;  // 90% 折扣
        }
        return rent;
    }

    /**
     * 租车流程
     */
    public void leaseOutFlow() {
        System.out.print("请输入您要租赁的天数: ");
        int days = scanner.nextInt();
        System.out.println("分配给您的汽车牌号是：" + vehicleId);
        System.out.println("您需要支付的租赁费用是：" + calRent(days) + "元。");
    }

    // Getter 和 Setter 方法
    public String getVehicleId() {
        return vehicleId;
    }

    public void setVehicleId(String vehicleId) {
        this.vehicleId = vehicleId;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public int getPerRent() {
        return perRent;
    }
    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public void setPerRent(int perRent) {
        this.perRent = perRent;
    }
}
